package gui_xmlparser;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.SAXException;

/**
 *
 * Rivera, Valencia, De Grano, Tan, Macatangay
 */
public class XML {
	private String XMLfile;
	private SAXhandler handler;
	
	public XML(String s)
	{
		XMLfile=s;
	}
	
	public void setHandler(SAXhandler handler)
	{
		this.handler = handler;
	}
	
	public void read() throws ParserConfigurationException, SAXException
	{
		SAXParserFactory factory = SAXParserFactory.newInstance();
		SAXParser saxParser = factory.newSAXParser();
		
		try
		{
			saxParser.parse(XMLfile,handler);
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}
}
